/*
 * Write a C++ program to check
 * if a given number is prime or not
 */

# include <iostream>
using namespace std;

class PrimeCheck {
  int number;
public:
  void getNumber();
  void checkPrime();
};

void PrimeCheck::getNumber() {
  cout << "Enter the number: ";
  cin >> number;
}

void PrimeCheck::checkPrime() {
  bool isPrime = true;
  int ind = 2;
  while(ind <= number/2) {
    if(number % ind++ == 0) {
      cout << "Number is not prime!" << endl;
      isPrime = false;
      break;
    }
  }
  if(isPrime) {
    cout << "Number is prime!" << endl;
  }
}

int main() {
  PrimeCheck pc;
  pc.getNumber();
  pc.checkPrime();
	return 0;
}
